package com.cruise.h5.mapper;
import com.cruise.h5.pojo.entity.Video;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author cruise
 * @since 2021-03-25
 */
@Mapper
public interface VideoMapper extends BaseMapper<Video> {
    /**
     * 喜欢数 +1
     * @param id
     */
    @Update("update b_video set like_count = like_count + 1 where id = #{id}")
    void like(@Param("id") String id);

    /**
     * 喜欢数 -1
     * @param id
     */
    @Update("update b_video set like_count = like_count - 1 where id = #{id}")
    void cancelLike(@Param("id") String id);

    /**
     * 评论数 +1
     * @param id
     */
    @Update("update b_video set comment_count = comment_count + 1 where id = #{id}")
    void addCommentCount(@Param("id")String id);

    /**
     * 评论数 -1
     * @param id
     */
    @Update("update b_video set comment_count = comment_count - 1 where id = #{id}")
    void minusCommentCount(@Param("id")String id);

    /**
     * 点踩数 + 1
     * @param id
     */
    @Update("update b_video set dislike_count = dislike_count + 1 where id = #{id}")
    void disLike(@Param("id") String id);

    /**
     * 点踩数 -1
     * @param id
     */
    @Update("update b_video set dislike_count = dislike_count - 1 where id = #{id}")
    void cancelDisLike(@Param("id") String id);

    /**
     * 收藏数 + 1
     * @param id
     */
    @Update("update b_video set collect_count = collect_count + 1 where id = #{id}")
    void addCollectCount(String id);
    /**
     * 收藏数 - 1
     * @param id
     */
    @Update("update b_video set collect_count = collect_count - 1 where id = #{id}")
    void cancelCollectCount(String id);
}
